package cn.xej.test;

import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Herman.Wang
 * @version $ Id: DefaultProductFactory.java, v 0.1 Herman Exp $
 * @date 2021-11-22 15:32:28
 * @654c1a54
 */

@Service
public class DefaultProductFactory implements ProductFactory{
    private final Map<String, ProductModelService> map = new HashMap<>();

    public DefaultProductFactory() {
        System.out.println(this);
        System.out.println("DefaultProductFactory ...");

    }

    @Override
    public void registerProductService(String type, ProductModelService productModelService) {
        map.put(type, productModelService);
    }

    @Override
    public ProductModelService getProductService(String type) {
        return map.get(type);
    }
}
